/**
 * 
 */
package orderProcessingProcess.client.junit;


import static org.junit.Assert.fail;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import orderProcessingProcess.exceptions.faults.ItemUnavailableFault;
import orderProcessingProcess.exceptions.faults.UnknownItemFault;
import orderProcessingProcess.exceptions.faults.UnknownOrderFault;
import orderProcessingProcess.model.Address;
import orderProcessingProcess.model.Customer;
import orderProcessingProcess.model.Item;
import orderProcessingProcess.model.Order;
import orderProcessingProcess.model.Payment_Preference;
import orderProcessingProcess.server.OrderManagementService;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;


/**
 * @author charly
 *
 */
public final class MyTestOrderManagementService {


	private static OrderManagementService client;
    
    @BeforeClass
    public static void init()
    {
    	JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    	factory.getInInterceptors().add(new LoggingInInterceptor());
    	factory.getOutInterceptors().add(new LoggingOutInterceptor());
    	factory.setServiceClass(OrderManagementService.class);
    	factory.setAddress("http://localhost:8083/orderservice");
    	client = (OrderManagementService) factory.create();
    }

    @Test
    public void check_availabilityTest()
    {
    	Item item = new Item(1, "1", null,null);
    	try 
    	{
			Assert.assertTrue(client.check_availability(item));
		} 
    	catch (UnknownItemFault e) 
    	{
			e.printStackTrace();
		}
    }

}